/**
 * Created by zhulingxiao on 2017/6/6.
 */
//将 参数 转 成 form-data
import 'whatwg-fetch';
import Promise from 'promise-polyfill';

if (!window.Promise) {
  window.Promise = Promise;
}

// export const URL = 'http://192.168.1.201:1234/api';
// export const IMG_URL = 'http://192.168.1.201:1234/images/';

export const URL = 'https://developer.aqmic.com/api';
export const IMG_URL = 'https://developer.aqmic.com/images/';

export const myFetch = (url,data) => {

    return fetch(url,{

        method: 'POST',

        headers: {

            'Content-Type': 'application/json' //POST 请求

        },

        body:JSON.stringify(data)

    })

        .then((data) => data.json())

        .then((data)=> {


            if(data.state){

                return data;

            }else {

                return false;

            }

        })

        .catch(error => {

            return error

        })
};

